<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
</script>

<template>
  <header>
    <img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />

    <h1>Vue 3 文档</h1>

    <div class="wrapper">
      <nav>
        <RouterLink to="/">Home</RouterLink>
        <RouterLink to="/about">About</RouterLink>
        <RouterLink to="/template">模板配置</RouterLink>
        <RouterLink to="/refUse">响应式基础</RouterLink>
        <RouterLink to="/refUse2Reactive">ref和Reactive区别</RouterLink>
        <RouterLink to="/computedAttribute">计算属性</RouterLink>
        <RouterLink to="/bindHtmlClass">Class 与 Style 绑定</RouterLink>
        <RouterLink to="/ifElseConpiment">条件渲染</RouterLink>
        <RouterLink to="/forCompoment">列表渲染</RouterLink>
        <RouterLink to="/eventCompomnet">事件处理</RouterLink>
        <RouterLink to="/formCompoment">form表单</RouterLink>
        <RouterLink to="/vuelifecycle">VUE生命周期见控制台打印</RouterLink>
        <RouterLink to="/watchCompoment">VUE侦听器</RouterLink>
        <RouterLink to="/watchEffectCompoment">watchEffect侦听器用法</RouterLink>
        <RouterLink to="/watchPostVue2Compoment">VUE2侦听器</RouterLink>
        <RouterLink to="/watchPostVue3Compoment">VUE3侦听器</RouterLink>
        <RouterLink to="/templateRefCompoment">模板引用</RouterLink>
        <RouterLink to="/webComponentBase">组件基础用法</RouterLink>
        <RouterLink to="/compomentDef">全局局部组件定义</RouterLink>
        <RouterLink to="/propsCompoment">props</RouterLink>
        <RouterLink to="/emitEvent">组件事件</RouterLink>
        <RouterLink to="/vmodelParent">父子组件v-model绑定</RouterLink>
        <RouterLink to="/attributesCompoment">透传 Attributes</RouterLink>
        <RouterLink to="/fatherButtonCompoment">父子组件Attributes</RouterLink>
        <RouterLink to="/slotsCompoment">插槽内容输入</RouterLink>
        <RouterLink to="/injectCompomentTest">依赖注入测试</RouterLink>
        <RouterLink to="/asyncComp">异步组件</RouterLink>
        <RouterLink to="/compositeFunc">组合函数测试</RouterLink>
        <RouterLink to="/customDirectives">自定义指令</RouterLink>
        <RouterLink to="/pluginCmp">插件开发</RouterLink>
      </nav>
    </div>
  </header>

  <RouterView />
</template>

<style scoped>
header {
  line-height: 1.5;
  max-height: 100vh;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

nav {
  width: 100%;
  font-size: 12px;
  text-align: center;
  margin-top: 2rem;
}

nav a.router-link-exact-active {
  color: var(--color-text);
}

nav a.router-link-exact-active:hover {
  background-color: transparent;
}

nav a {
  display: inline-block;
  padding: 0 1rem;
  border-left: 1px solid var(--color-border);
}

nav a:first-of-type {
  border: 0;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }

  nav {
    text-align: left;
    margin-left: -1rem;
    font-size: 1rem;

    padding: 1rem 0;
    margin-top: 1rem;
  }
}
</style>
